//
//  init.h
//  Estate
//
//  Created by heyong on 16/7/29.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Address.h"
#import "Attachment.h"
#import "Process.h"
#import "ProcessRecord.h"
#import "ProEngineerSurvey.h"
#import "Project.h"
#import "ProjectUnit.h"
#import "ProjectUser.h"
#import "Unit.h"
#import "User.h"
#import "WorkDiary.h"
#import "WorkLog.h"
#import "WorkRecord.h"
#import "Advertising.h"
#import "SystemConfig.h"

@interface dataInit : NSObject
{
    NSURLSessionDownloadTask *_downloadTask;
    NSThread *_downThread;
}

@property (strong, nonatomic)FMDatabase *db;

/**
 * 单位列表
 */
@property(strong, nonatomic)NSMutableArray *unitArray;

/**
 * 用户列表
 */
@property(strong, nonatomic) NSMutableArray *userArray;

/**
 * 项目列表
 */
@property(strong, nonatomic)NSMutableArray *projectArray;
/**
 * 项目单位列表
 */
@property(strong, nonatomic)NSMutableArray * proUnitsArray;
/**
 * 项目用户列表
 */
@property(strong, nonatomic)NSMutableArray *proUsersArray;
/**
 * 项目工程概况列表
 */
@property(strong, nonatomic)NSMutableArray *proEngineerSurveyArray;
/**
 * 项目地址列表
 */
@property(strong, nonatomic)NSMutableArray *addressArray;
/**
 * 工作记录列表
 */
@property(strong, nonatomic)NSMutableArray *workRecordArray;
/**
 * 工作日记列表
 */
@property(strong, nonatomic)NSMutableArray *workDiaryArray;
/**
 * 工作日志列表
 */
@property(strong, nonatomic)NSMutableArray *workLogArray;
/**
 * 流程列表
 */
@property(strong, nonatomic)NSMutableArray * processArray;
/**
 * 流程记录列表
 */
@property(strong, nonatomic)NSMutableArray *processRecordArray;

/**
 * 见证取样流程表
 */
@property(strong, nonatomic)NSMutableArray *sampleProcessArray;
/**
 * 见证取样流程记录表
 */
@property(strong, nonatomic)NSMutableArray *samplePRArray;
/**
 * 见证取样二维码表
 */
@property(strong, nonatomic)NSMutableArray *sampleCodeArray;
/**
 * 巡检流程表
 */
@property(strong, nonatomic)NSMutableArray *inspectProcessArray;
/**
 * 巡检流程记录表
 */
@property(strong, nonatomic)NSMutableArray *inspectPRArray;
/**
 * 巡检项实体表
 */
@property(strong, nonatomic)NSMutableArray *inspectItemArray;
/**
 * 用户巡检项表
 */
@property(strong, nonatomic)NSMutableArray *inspectUserItemArray;
/**
 * 巡检组表
 */
@property(strong, nonatomic)NSMutableArray *inspectGroupArray;
/**
 * 用户巡检组表
 */
@property(strong, nonatomic)NSMutableArray *inspectGroupUserArray;
/**
 * 一键汇总表
 */
@property(strong, nonatomic)NSMutableArray *inspectTotalRecordArray;

/**
 * 附件列表
 */
@property(strong, nonatomic)NSMutableArray *attachmentArray;

/**
 *  广告表
 */
@property (strong, nonatomic)NSMutableArray *advertisementArray;
/**
 *  配置表
 */
@property (strong, nonatomic)NSMutableArray *systemConfigArray;


/**
 * 巡视记录
 */
@property(strong, nonatomic)NSMutableArray *patrolRecordArray;
/**
 * 安全记录基本表
 */
@property(strong, nonatomic)NSMutableArray *securityRecordBasicArray;
/**
 * 安全记录-安全巡查
 */
@property(strong, nonatomic)NSMutableArray *securityPatrolArray;
/**
 * 安全记录-施工三类人员
 */
@property(strong, nonatomic)NSMutableArray *threeTypePeopleArray;
/**
 * 安全记录-危险性较大工程
 */
@property (strong, nonatomic)NSMutableArray *dangerousWorkArray;
/**
 * 安全记录-特种作业人员
 */
@property (strong, nonatomic)NSMutableArray *specialOperationsPersonnelArray;
/**
 * 安全记录-施工设备进场
 */
@property (strong, nonatomic)NSMutableArray *workDeviceApproachArray;


//进度条
@property (assign, nonatomic)CGFloat value;
@property (strong, nonatomic)UILabel *lab;
@property (strong, nonatomic)UIProgressView *progress;
@property (strong, nonatomic)MBProgressHUD *hud;

//标识是否是同步附件下载
//@property(copy, nonatomic)NSString *dataSync;

//下载完的信息回调
@property (nonatomic, copy) void(^blockMainTab)(void);
//存储附件名和附件id/
@property (nonatomic ,strong) NSMutableDictionary *fileDic;
//初始化方法
-(void)initWithResponseObject:(id)object;
//存储记录表
- (void)saveWorkRecord:(NSMutableArray *)workRecordArray;

//广告表
-(void)saveAdvertisement:(NSMutableArray *)advertisMent;

//配置表
-(void)saveSystemConfigArray:(NSMutableArray *)systemConfigArray;


//存储日记表
- (void)saveDiary:(NSMutableArray *)workDiaryArray;
//存储日志表
- (void)saveWorkLog:(NSMutableArray *)workLogArray;
//存储人员表
- (void)saveUser:(NSMutableArray *)userArray;
//存储单位表
- (void)saveUnit:(NSMutableArray *)unitArray;
//存储单位人员
- (void)saveProUsers:(NSMutableArray *)proUsersArray;
//存储项目单位表
- (void)saveProUnits:(NSMutableArray *)proUnitsArray;
// 存储流程表
- (void)saveProcess:(NSMutableArray *)processArray;

// 见证取样流程表
- (void)saveSampleProcess:(NSMutableArray *)sampleArray;
// 见证取样流程记录表
- (void)saveSampleRecord:(NSMutableArray *)sampleRecordArray;
// 巡检流程
- (void)saveInspectProcess:(NSMutableArray *)inspectProcessArray;
// 巡检流程记录
- (void)saveInspectProcessRecord:(NSMutableArray *)inspectRecordArray;
// 巡检项
- (void)saveInspectItem:(NSMutableArray *)inspectItemArray;
// 用户巡检项
- (void)saveInspectUserItem:(NSMutableArray *)inspectUserItemArray;
// 巡检组
- (void)saveInspectGroup:(NSMutableArray *)inspectGroupArray;
// 巡检组用户表
- (void)saveInspectGroupUser:(NSMutableArray *)inspectGroupUserArray;
// 一键汇总表
- (void)saveInspectTotalRecord:(NSMutableArray *)inspectTotalRecordArray;
// 巡视记录表
- (void)savePatrolRecordArray:(NSMutableArray *)patrolRecordArray;
// 安全记录基本表
- (void)saveSecurityRecordBasic:(NSMutableArray *)securityRecordBasicArray;
// 安全记录-安全巡查
- (void)saveSecurityPatrol:(NSMutableArray *)securityPatrolArray;
// 安全记录-施工三类人员
- (void)saveThreeTypePeople:(NSMutableArray *)threeTypePeopleArray;
// 安全记录-危险性较大工程
- (void)saveDangerousWork:(NSMutableArray *)dangerousWorkArray;
// 安全记录-特种作业人员
- (void)saveSpecialOperationsPersonnel:(NSMutableArray *)specialOperationsPersonnelArray;
// 安全记录-施工设备进场
- (void)saveWorkDeviceApproach:(NSMutableArray *)workDeviceApproachArray;
//存储附件表
-(void)saveAttachment:(NSMutableArray *)attachmentArray andDownLoad:(BOOL)isDown;

//同步附件下载
-(void)syncFileImage;
//更新附件下载改版
-(void)syncFileImage2;
//同步完回调
@property (nonatomic, copy) void(^blockSyncOver)(void);

//进度
@property (assign, nonatomic)  int completedCount;
@property (assign, nonatomic) int sumCompletedCount;

//是否退出
@property (assign , nonatomic) BOOL exit;

//下载附件表（图片）
- (void)downLoadImage:(NSString *)imageId andFileName:(NSString *)fileName andJumpBar:(BOOL)isJump;

//下载附件 (PDF)
- (void)downLoadFilePdf:(NSString *)fileId andFileName:(NSString *)fileName andView:(UIView *)view AndFileType:(NSString *)fileType;

@end
